<?php
namespace app\index\controller;
use app\model\Video as VideoModel;
use think\console\command\make\Controller;

class Video extends Controller{
    public function add(){
        header('Access-Control-Allow-Origin:*');
		header('Access-Control-Allow-Methods:POST,GET,OPTIONS');
		header('Access-Control-Allow-Headers:x-requested-with,content-type,requesttype,token');
        $request = VideoModel::select();
        return json($request);
    }

    public function dunmylist(){
        header('Access-Control-Allow-Origin:*');
		header('Access-Control-Allow-Methods:POST,GET,OPTIONS');
		header('Access-Control-Allow-Headers:x-requested-with,content-type,requesttype,token');
        $request = @file_get_contents('php://input'); 
        $request = json_decode($request,TRUE);
        $video = new VideoModel;
      
        $insert = $video->allowField(['vurl','vname','vimg'])->save($request);
        echo $insert;
    }

    
    

}